package com.bwie.controller;

import com.bwie.pojo.TbGroupActive;
import com.bwie.pojo.TbGroupJoin;
import com.bwie.service.TbGroupJoinService;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @description : 商家拼团活动
 * @Author QiHainan
 * @Create 2025/7/27 15:09
 * @Version 1.0
 */
@RestController
@RequestMapping("/team/join")
public class JoinController {
    @Autowired
    TbGroupJoinService tbGroupJoinService;

    /**
     * 获取商家拼团活动分页列表
     * @param pageInfoVo
     * @return
     */
    @PostMapping("/getGroupJoinPage")
    public R getGroupJoinPage(@RequestBody PageInfoVo pageInfoVo){
        return tbGroupJoinService.getGroupJoinPage(pageInfoVo);
    }

    /**
     * 添加商家拼团活动
     * @param tbGroupJoin
     * @return
     */
    @PostMapping("/addGroupJoin")
    public R addGroupJoin(@RequestBody TbGroupJoin tbGroupJoin){
        return tbGroupJoinService.addGroupJoin(tbGroupJoin);
    }

    /**
     * 修改商家拼团活动信息
     * @param tbGroupJoin
     * @return
     */
    @PostMapping("/updateGroupJoin")
    public R updateGroupJoin(@RequestBody TbGroupJoin tbGroupJoin){
        return tbGroupJoinService.updateGroupJoin(tbGroupJoin);
    }

    /**
     * 根据ID删除拼团活动
     * @param joinId
     * @return
     */
    @PostMapping("/deleteGroupJoin/{joinId}")
    public R deleteGroupJoin(@PathVariable("joinId") Integer joinId){
        return tbGroupJoinService.deleteGroupJoin(joinId);
    }
}
